<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>确认订单信息</title>
	<meta name="viewport" content="target-densitydpi=device-dpi,width=720, user-scalable=no" id="viewport">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link type="text/css" rel="stylesheet" media="screen" href="__FONT__/css/style.css{$JSDEBUG}"/>
    <link type="text/css" rel="stylesheet" media="screen" href="__FONT__/css/media.css{$JSDEBUG}"/>
    <link type="text/css" rel="stylesheet" media="screen" href="__FONT__/css/hack.css{$JSDEBUG}"/>
    <script type="text/javascript" src="__FONT__/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
		$(function(){
			var price = parseFloat('{$serviceItem.price}');
		  
		  	$(".pay_discount h1").click(function(){
			  	$(".pay_show").slideToggle();
			  	$(".pay_method").css('padding-bottom','30px');
			  	if( $(".pay_discount h1 i").hasClass('rotation')){
					  $(".pay_discount h1 i").removeClass('rotation');
				}else{
					 $(".pay_discount h1 i").addClass('rotation');
				}
			});
		  
		  	$(".pay_show dd").click(function(){
		  		$("#couponId").val($(this).attr('data-id'));
			  	if (!$(this).find('i').length) {
				  	$(this).children('label').after('<i></i>');
			  	} else {
				  	$(this).find('i').show();
			  	}
			 
			  	$(this).siblings().children('i').hide();
			  	$(".add_pay").html($(this).html());
			  	$(".pay_show").slideToggle('slow');
			  	
			  	$("#priceShow").text(price - parseFloat($(this).attr('data-dec')));
			});
		});
	</script>
    <style>
	
	</style>
</head>
<body style="background:#f7f7f9;">
	<include file="Public/customHeader" title="确认订单信息" url="{:U('serviceItem/detail/id/'.$serviceItem['id'].'/beauty_id/'.$beautyParlor['id'].'/beautician_id/'.$beautician['id'].'/selectTime/'.$order_time)}"/>
 	<form method="post" action="{:U('/Pay/index')}">
 	<input type="hidden" name="service_id" value="{$serviceItem.id}">
 	<input type="hidden" name="beauty_id" value="{$beautyParlor.id}">
 	<input type="hidden" name="beautician_id" value="{$beautician.id}">
 	<input type="hidden" name="user_id" value="{$user_id}">
 	<input type="hidden" name="order_time" id="orderTime" value="{$order_time}">
 	<input type="hidden" name="coupon_id" id="couponId" value="{$defaultCoupon.id}">
 	<input type="hidden" name="pay_method_type" id="payMethodType" value="1">
 	<section class="beauty_sec beauty_pay">
      <div class="pay_main hackpay">
        <h1>{$beautyParlor.name}</h1>
        <h2><font>项目：</font><span>{$serviceItem.service_name}</span><label>￥{$serviceItem.price}</label></h2>
        <div class="pay_myself">
          <if condition="$beautician['profile_img']">
	       <img src="__UPLOADS__/Profile/{$beautician.profile_img}">
	       <else />
	       <img src="__FONT__/images/defaultProfile.png">
	       </if>
          <dd>
            <strong><span>美&nbsp;&nbsp;容&nbsp;&nbsp;师：</span><label>{$beautician.name}</label></strong>
            <strong><span>服务时间：</span><label>{$serviceItem.service_time}分钟</label></strong>
          </dd>
        </div>
        <div class="pay_yourself payhei">
            <strong><span>预&nbsp;&nbsp;约&nbsp;&nbsp;人：</span><label>{$user.username}</label><a>（{$user.mobile}）</a></strong>
            <strong><span>预约时间：</span><label>{$order_time|date="Y-m-d H:i",###}</label></strong>
            <strong><span>服务地址：</span><label class="mydress">{$beautyParlor.address}</label></strong>
        </div>
      </div>
      
      <if condition="$coupons">
      <div class="pay_discount">
        <h1>优惠券：<i></i></h1>
        <dd class="add_pay"><span>{$defaultCoupon.coupon_title}</span><label>-￥<if condition="$defaultCoupon['c_type'] eq 2">{$defaultCoupon.money_amount}<else />{$defaultCoupon.money_reduce}</if></label></dd>
        <div class="pay_show">
          <foreach name="coupons" item="coupon">
          <if condition="$coupon ['c_type'] neq 2">
          <dd data-id="{$coupon.id}" data-dec="{$coupon.money_reduce}">
          <else />
          <dd data-id="{$coupon.id}" data-dec="{$coupon.money_amount}">
          </if>
          <span>{$coupon.coupon_title}</span><label>-￥<if condition="$coupon['c_type'] eq 2">{$coupon.money_amount}<else />{$coupon.money_reduce}</if></label>
          <if condition="$defaultCoupon ['id'] eq $coupon ['id']"><i></i></if></dd>
          </foreach>
          <dd data-id='0' data-dec="不使用优惠券"><span>不使用优惠券</span><label></label></dd>
        </div>
      </div>
      </if>
      
      <div class="pay_method">
        <h1>支付方式：</h1>
        <dd><span>微信支付</span><label></label></dd>
      </div>
	</section>
    <footer class="pay_going gopay">
       <dd>
	       <span>实付金额：</span><label>￥<font id="priceShow">{$pay}</font></label>
	       <a href="javascript:void(0);" class="hackpay" id="pay">去支付</a>
       </dd>
    </footer>
    </form>
    <script>
    	function onBridgeReady(){
			  WeixinJSBridge.call('hideOptionMenu');
		}
		
		if (typeof WeixinJSBridge == "undefined"){
		    if( document.addEventListener ){
		        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		    }else if (document.attachEvent){
		        document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
		        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		    }
		}else{
		    onBridgeReady();
		}
		
    	$(function () {
    		$('#pay').click(function () {
    			var form = $('form');
    			history.replaceState(1, "美滴滴",'{:U("ServiceItem/index")}');
    			$(form).submit();
        	});
    	});
    </script>
</body>
</html>